﻿<?php
session_start();
function img(){
$im=imagecreate(50,20);
$white=imagecolorallocate($im,255,255,255);
$black=imagecolorallocate($im,0,0,0);
imagerectangle($im,0,0,49,19,$black);
$temp=0;
$temp3="";
$_SESSION["img"] = null;
for ($i=1;$i<5;$i++){
$temp1=rand(0,9);
$temp3=$temp3.strval($temp1);
$color1=rand(0,255);
$color2=rand(0,255);
$color3=rand(0,255);
$color=imagecolorallocate($im,$color1,$color2,$color3);
imagechar($im,16,5+$temp,2,$temp1,$color);
$temp=$temp+10;
for ($j=0;$j<15;$j++){
$point_x=rand(2,48);
$point_y=rand(2,18);
$color=imagecolorallocate($im,$color1,$color2,$color3);
imagesetpixel($im,$point_x,$point_y,$color);
}
}
$_SESSION["img"]=$temp3;
imagegif($im);

}
img();
?>